package com.worldcup.service.question.calculator;

import com.worldcup.model.enums.QuestionTypeEnum;

/**
 * @author duwan.zq
 * @date 2019/03/10
 */
public class AnswerCalculatorFactory {

    private static AssessCalculator assessCalculator = new AssessCalculator();

    private static CommonCalculator commonCalculator = new CommonCalculator();

    private static WatchFrequencyCalculator watchFrequencyCalculator = new WatchFrequencyCalculator();

    public static AnswerCalculator getCalcutorFactory(int questionType){
        if(questionType == QuestionTypeEnum.WATCH_FREQUENCY.getKey()){
            return watchFrequencyCalculator;
        }else if(questionType == QuestionTypeEnum.ASSESS.getKey()){
            return assessCalculator;
        }else if(questionType == QuestionTypeEnum.COMMON.getKey()){
            return commonCalculator;
        }else{
            throw new IllegalArgumentException("have no calculator, questionType = " + questionType);
        }
    }
}
